#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <error.h>
#include <unistd.h>
#include <string>
using namespace std;

int main()
{
    int fd = open("./test.txt", O_RDONLY);

    /* 也可以使用lseek获得文件的大小 比较方便 */
    off_t length = lseek(fd, -11, SEEK_END);
    cout << "length:" << length << endl;

    char buffer[32] = {0};
    read(fd, buffer, sizeof(buffer));
    cout << "buffer:" << buffer << endl;
    
    return 0;
}


